<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">

    </div>
    <script>
        const vm=new Vue({
            el:'#app',
            data:{
                val:'简单对象的初始值',
                obj:{
                    name:'复杂对象name',
                    value:'复杂对象value'
                }
            },
            watch: {
                val:function(new_val,old_val){
                    console.log("新的数据: "+new_val,"旧的数据: "+old_val);
                    console.log(this.val);
                },
                obj:{
                    deep:true,
                    handler:function(new_val,old_val){
                        console.log("新的数据: "+new_val,"旧的数据: "+old_val);
                        console.log(this.obj);
                    }
                }
            }
        })
    </script>
</body>
</html>